package com.example.leetdemo.finash;

public class Solution2348 {

    public long zeroFilledSubarray(int[] nums) {
        long j = 0;
        long sum = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0 && j != 0) {
                sum += (j * (j + 1)) / 2;
                j = 0;
            }
            if (nums[i] == 0) {
                j++;
            }
        }
        if (j != 0) {
            sum += (j * (j + 1)) / 2;
        }
        return sum;
    }

}
